<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>02绑定样式style</title>
  <script src="../js/vue.js"></script>
  <style>
    .basic {
      width: 400px;
      height: 100px;
      border: 1px solid black;
    }
    .happy {
      border: 4px solid red;
      background-color: rgba(255, 255, 0, 0.644);
      background: linear-gradient(30deg, yellow, pink, orange, yellow);
    }
    .sad {
      border: 4px dashed rgb(2, 197, 2);
      background-color: gray;
    }
    .noraml {
      background-color: skyblue;
    }
    .demo1 {
      background-color: yellowgreen;
    }
    .demo2 {
      font-size: 30px;
      text-shadow: 2px 2px 10px red;
    }
    .demo3 {
      border-radius: 20px;
    }
  </style>
</head>
<body>
  <div id="app">
    <!-- 1 对象形式 -->
    <div class="basic" :style="{fontSize: number+'px'}">{{title}}</div>
    <div class="basic" :style="obj">{{title}}</div>
    <!-- 2 数组形式 -->
    <div class="basic" :style="[obj, obj2]">{{title}}</div>
    <div class="basic" :style="arr">{{title}}</div>
    <!-- 上述两种形式，样式对象中的属性名都是驼峰命名法的样式属性名 -->
  </div>
  <script>
    new Vue({
      el: '#app',
      data() {
        return {
          title: '绑定样式style',
          number: 40,
          obj: {
            fontSize: '40px',
            backgroundColor: 'yellowgreen'
          },
          obj2: {
            color: 'orange'
          },
          arr: [
            {
              fontSize: '40px',
              backgroundColor: 'yellowgreen'
            },
            {
              color: 'orange'
            }
          ]
        }
      }
    })
  </script>
</body>
</html>